import http from '@src/util/http' 
let prefix = '/api/app/outside'
let prefixOther = '/api/user'
/**
 * @description 服务商树
 * @param {Object} params 参数对象
 */
export function tree(params = {}) {
  return http.post('/serviceProvider/tree', params)
}
/** 
 * @description 查询服务商详情
 * @param {Object} params 参数对象
 */
export function info(params = {}) {
  return http.get('/serviceProvider/info', params)
}
/** 
 * @description 企查查
 * @param {Object} params 参数对象
 */
export function searchCompany(params = {}) {
  return http.post('/serviceProvider/searchCompany', params)
}

/**
 * @description 注册服务商企查查
 * @param {Object} params 参数对象
 */
export function searchCompanyRegister(params = {}) {
  return http.post('/serviceProvider/searchCompany/out', params)
}


/** 
 * @description 新建服务商
 * @param {Object} params 参数对象
 */
export function create(params = {}) {
  return http.post('/serviceProvider/create', params)
}
/** 
 * @description 服务商列表
 * @param {Object} params 参数对象
 */
export function list(params = {}) {
  return http.post('/serviceProvider/list', params)
}
/** 
 * @description 删除服务商
 * @param {Object} params 参数对象
 */
export function serviceProviderDelete(params = {}) {
  return http.post('/serviceProvider/delete', params)
}
/** 
 * @description 编辑服务商
 * @param {Object} params 参数对象
 */
export function edit(params = {}) {
  return http.post('/serviceProvider/edit', params)
}
/** 
 * @description 获取服务商角色
 * @param {Object} params 参数对象
 */
export function providerRole(params = {}) {
  return http.get('/serviceProvider/providerRole', params)
}
/** 
 * @description 绑定服务商用户
 * @param {Object} params 参数对象
 */
export function bindUser(params = {}) {
  return http.post('/serviceProvider/bindUser', params)
}

/** 
 * @description 绑定服务商用户
 * @param {Object} params 参数对象
 */
export function getRoleTree(params = {}) {
  return http.get('/security/role/getRoleTree', params)
}
/** 
 * @description 绑定服务商用户
 * @param {Object} params 参数对象
 */
export function userTag(params = {}) {
  return http.get('/serviceProvider/userTag', params)
}
/** 
 * @description 检查人员信息
 * @param {Object} type 组织类型
 * @param {Object} userIds 人员id
 */
export function checkUser(params = {}) {
  return http.post('/serviceProvider/checkUser', params)
}
/** 
 * @description 移动成员到组织架构 
 * @param {Object} params 参数对象
 */
export function moveUserToTag(params = {}) {
  return http.post('/serviceProvider/moveUserToTag', params)
}
/** 
 * @description 新增资质 
 * @param {Object} params 参数对象
 */
export function addQualifications(params = {}) {
  return http.post('/qualifications/addQualifications', params)
}
/** 
 * @description 获取资质分页 
 * @param {Object} params 参数对象
 */
export function getQualifications(params = {}) {
  return http.post('/qualifications/getQualifications', params)
}
/** 
 * @description 删除资质证书 
 * @param {Object} params 参数对象
 */
export function deleteQualifications(params = {}) {
  return http.post('/qualifications/deleteQualifications', params)
}
/** 
 * @description 更新资质证书 
 * @param {Object} params 参数对象
 */
export function updateQualifications(params = {}) {
  return http.post('/qualifications/updateQualifications', params)
}

/**
 * @description 获取服务商表单模板
 * @returns
 */
export function getServiceManageTemplate(params = {}) {
  return http.get('/api/app/outside/provider/setting/searchConfig', params);
}

/** ********服务商管理**************/
/**
 * @description 获取服务商表单模板
 * @returns
 */
export function searchServiceManageTemplate(params = {}) {
  return http.get(`${prefix}/provider/setting/searchConfig`, params);
}
/**
 * 获取授权工单类型
 * @param params
 * @returns {*}
 */
export function searchTaskTypeList(params = {} ) {
  return http.post(`${prefix}/provider/common/getTaskTypeDropDownList`, params);
}

/**
 * 注册获取授权工单类型
 * @param params
 * @returns {*}
 */
export function getRegisterTaskTypeList(params = {} ) {
  return http.post(`${prefix}/provider/common/getRegisterTaskTypeList`, params);
}

/**
 * 获取授权产品类型
 * @param params
 * @returns {*}
 */
export function searchProductTypeList(params = {}) {
  return http.post(`${prefix}/provider/common/getProductDropDownList`, params);
}

/**
 * 注册获取授权产品类型
 * @param params
 * @returns {*}
 */
export function getRegisterProductTypeList(params = {}) {
  return http.post(`${prefix}/provider/common/getRegisterProductTypeList`, params);
}
/**
 * 保存服务商
 * @param params
 * @returns {*}
 */
export function saveOrUpdateProviderInfo(params = {}) {
  return http.post(`${prefix}/provider/form/saveOrUpdateProviderInfo`, params);
}

/**
 * 服务商获取角色
 * @param params
 * @returns {*}
 */
export function getServiceRole(params = {}) {
  return http.get('/api/user/outside/provider/role/getProviderRoleList', params);
}

/**
 * 工程师获取角色
 * @param params
 * @returns {*}
 */
export function getEngineerRole(params = {}) {
  return http.get('/api/user/outside/provider/role/getEngineerRoleList', params);
}

/**
 * 服务商信息
 * @param params
 * @returns {*}
 */
export function getProviderDataInfo(params = {}) {
  return http.get(`${prefix}/provider/form/getDataInfo`, params);
}

/**
 * 服务商&工程师动态信息
 * @param params
 * @returns {*}
 */
export function getRecordList(params = {}) {
  return http.get(`${prefix}/provider/common/getRecordList`, params);
}

/**
 * 服务商详情工单列表
 * @param params
 * @returns {*}
 */
export function getProviderTaskList(params = {}) {
  return http.post('/api/task/outside/service/provider/task/list', params);
}

/**
 * 注销服务商
 * @param params
 * @returns {*}
 */
export function stopProvider(params = {}) {
  return http.get(`${prefix}/provider/form/stopProvider`, params);
}

/**
 * 校验服务商重复
 * @param params
 * @returns {*}
 */
export function checkTenantProviderExist(params = {}) {
  return http.get(`${prefix}/provider/form/checkTenantProviderExist`, params);
}

/**
 * 校验服务商编码重复
 * @param params
 * @returns {*}
 */
export function codeRepeatCheck(params = {}) {
  return http.get(`${prefix}/provider/form/codeRepeatCheck`, params);
}

/**
 * 校验税号重复
 * @param params
 * @returns {*}
 */
export function checkProviderTaxNoExist(params = {}) {
  return http.get(`${prefix}/provider/form/checkTenantProviderTaxNoExist`, params);
}


/**
 * 注册校验税号重复
 * @param params
 * @returns {*}
 */
export function checkProviderRegisterTaxNo(params = {}) {
  return http.get(`${prefix}/provider/register/checkProviderRegisterTaxNo`, params);
}

/** ***工程师*******/
/**
 * 保存工程师
 * @param params
 * @returns {*}
 */
export function saveOrUpdateEngineerInfo(params = {}) {
  return http.post(`${prefix}/engineer/form/saveOrUpdateInfo`, params);
}

/**
 * 所属服务商查询
 * @param params
 * @returns {*}
 */
export function getProviderPageList(params = {}) {
  return http.post(`${prefix}/provider/form/getProviderPageList`, params);
}

/**
 * 工程师信息
 * @param params
 * @returns {*}
 */
export function getEngineerDataInfo(params = {}) {
  return http.post(`${prefix}/engineer/form/getEngineerInfo`, params);
}

/**
 * 工程师信息（头部信息）
 * @param params
 * @returns {*}
 */
export function getEngineerDetailInfo(params = {}) {
  return http.post(`${prefix}/engineer/form/getEngineerDetailInfo`, params);
}

/**
 * 校验登录账号重复
 * @param params
 * @returns {*}
 */
export function checkEngineerPhone(params = {}) {
  return http.get('/security/user/unique', params);
}


/**
 * 校验工程师编码重复
 * @param params
 * @returns {*}
 */
export function engineerCodeRepeatCheck(params = {}) {
  return http.get(`${prefix}/engineer/form/codeRepeatCheck`, params);
}

/**
 * @description 获取工程师表列表初始化
 * @returns
 */
export function getServiceEngineerInit(params = {}) {
  return http.get(`${prefix}/engineer/form/list/init`, params);
}

/**
 * 获取工程师列表信息
 * @param params
 * @returns {*}
 */
export function getEngineerPageList(params = {} ) {
  return http.post(`${prefix}/engineer/form/getEngineerPageList`, params);
}

/**
 * 删除账号
 * @param params
 * @returns {*}
 */
export function deleteEngineer(params = {}) {
  return http.get('/api/user/outside/user/delete', params);
}

/**
 * @description 注销工程师
 * @returns {*}
 */
export function unbindUser(params = {}) {
  return http.post('/api/user/outside/tenant/provider/user/unbindUser', params)
}


/**
 * @description 查询所属服务商
 * @returns {*}
 */
export function getProviderDropDownList(params = {}) {
  return http.get(`${prefix}/provider/common/getProviderDropDownList`, params)
}

/**
 * 获取服务商树
 * @param params
 * @returns {*}
 */
export function getAllProviderTree(params) {
  return http.get(`${prefix}/provider/form/getAllProviderTree`, params);
}

/**
 * 获取部门的所属服务商
 * @param params
 * @returns {*}
 */
export function getProviderListByTagId(params) {
  return http.get(`${prefixOther}/outside/administer/provider/getProviderListByTagId`, params);
}

/**
 * 移除部门下的服务商
 * @param params
 * @returns {*}
 */
export function deleteByTagIdAndProviderId(params) {
  return http.post(`${prefixOther}/outside/administer/provider/deleteByTagIdAndProviderId`, params);
}

/**
 * 给团队添加关联服务商
 * @param params
 * @returns {*}
 */
export function saveByTagIdAndProviderIdList(params) {
  return http.post(`${prefixOther}/outside/administer/provider/saveByTagIdAndProviderIdList`, params);
}

/**
 * 团队添加服务商&服务商添加团队（一个接口处理）
 * @param params
 * @returns {*}
 */
export function saveProviderByType(params) {
  return http.post(`${prefixOther}/outside/administer/provider/save/user/option`, params);
}

/**
 * 获取服务商关系数据（一个接口处理，服务商&部门人员）
 * @param params
 * @returns {*}
 */
export function getProviderByType(params) {
  return http.get(`${prefixOther}/outside/administer/provider/get/user/option`, params);
}

/**
 * @description 获取服务商表列表初始化
 * @returns
 */
export function getServiceProviderInit(params = {}) {
  return http.get(`${prefix}/provider/form/list/init`, params);
}

/*
* @desc 服务商批量注销
*
*/
export function batchStopProvider(params = {}) {
  return http.post(`${prefix}/provider/form/batchStopProvider`, params);
}


/**
 * 服务商批量更新
 * @param params
 * @returns {*}
 */
export function batchUpdateProvider(params = {}) {
  return http.post(`${prefix}/provider/form/batchUpdate`, params);
}

/**
 * 启用停用工程师
 * @param params
 * @returns {*}
 */
export function openEngineer(params = {}) {
  return http.get('/security/user/enable', params);
}

/**
 * 工程师下拉分页
 * @param params
 * @returns {*}
 */
export function getEngineerDropDownList(params = {}) {
  return http.get(`${prefix}/provider/common/getEngineerDropDownList`, params);
}

/**
 * 设置主派单员
 * @param params
 * @returns {*}
 */
export function grantIsMain(params = {}) {
  return http.post(`${prefix}/engineer/form/grantIsMain`, params);
}

/**
 * 钉钉端添加成员
 * @param params
 * @returns {*}
 */
export function bindsUser(params = {}) {
  return http.post('/api/user/outside/tenant/provider/user/bindUser', params);
}

/**
 * @description 查询待分配人员
 * @returns {*}
 */
export function getUserList(params = {} ) {
  return http.post('/api/user/outside/user/getUserList', params)
}

/**
 * @description 获取服务商表单模板
 * @returns
 */
export function searchProviderConfig(params = {}) {
  return http.get(`${prefix}/provider/setting/provider/searchConfig`, params);
}

/**
 * @description 获取工程师表单模板
 * @returns
 */
export function searchEngineerConfig(params = {}) {
  return http.get(`${prefix}/provider/setting/engineer/searchConfig`, params);
}

/**
 * @description 保存服务商表单模板
 * @returns
 */
export async function saveProviderTemplate(params) {
  const res = await http.post(`${prefix}/provider/setting/provider/saveOrUpdateConfig`, params);
  return res;
}

/**
 * @description 保存工程师表单模板
 * @returns
 */
export async function saveEngineerTemplate(params) {
  const res = await http.post(`${prefix}/provider/setting/engineer/saveOrUpdateConfig`, params);
  return res;
}

/**
 * @description 获取服务商树
 * @returns
 */
export function getProviderTree(params = {}) {
  return http.get(`${prefix}/provider/form/getTree`, params);
}

/**
 * @description 该租户的服务商账号
 * @returns
 */
export function getTenantProviderAccountData(params = {}) {
  return http.get(`${prefix}/provider/form/getTenantProviderAccountData`, params);
}

/**
 * @description 服务商分配账户
 * @returns
 */
export function saveProviderAccount(params = {}) {
  return http.post(`${prefix}/provider/form/saveProviderAccount`, params);
}

/******服务商标签Start*****/
/**
 * @description 新建标签
 * @returns
 */
export function addProviderLabel(params = {}) {
  return http.post('/api/workbench/outside/communal/label/insert', params);
}

/**
 * @description 校验标签名称是否重复
 * @returns
 */
export function checkLabelNameRepeat(params = {}) {
  return http.post('/api/workbench/outside/communal/label/checkLabelNameRepeat', params);
}

/**
 * @description 获取所有标签列表
 * @returns
 */
export function getProvideAllLabel(params = {}) {
  return http.post('/api/workbench/outside/communal/label/getList', params);
}

/**
 * @description 修改标签列表
 * @returns
 */
 export function updateLabelName(params = {}) {
  return http.post('/api/workbench/outside/communal/label/updateLabelName', params);
}

/**
 * @description 删除标签列表
 * @returns
 */
 export function deleteListByIds(params = {}) {
  return http.post('/api/workbench/outside/communal/label/deleteListByIds', params);
}

/**
 * @description 编辑保存标签数据
 * @returns
 */
 export function labelSave(params = {}) {
  return http.post('/api/workbench/outside/communal/label/save', params);
}

/******服务商标签End*****/

/******服务商注册Start********/
/**
 * @description 获取服务商注册表单模板
 * @returns
 */
export function searchProviderRegisterConfig(params = {}) {
  return http.get(`${prefix}/provider/setting/register/searchConfig`, params);
}

/**
 * @description 获取服务商注册
 * @returns
 */
export function registerProvider(params = {}) {
  return http.post(`${prefix}/provider/register/create`, params);
}
/******服务商注册End********/

/******服务商修改自己的服务商信息Start********/
/**
 * @description 获取服务商修改模版
 * @returns
 */
export function searchEditConfig(params = {}) {
  return http.get(`${prefix}/provider/setting/edit/searchConfig`, params);
}
/******服务商修改自己的服务商信息End********/

/******服务商修改工程师信息Start********/
/**
 * @description 获取工程师修改模版
 * @returns
 */
export function searchEditEngineerConfig(params = {}) {
  return http.get(`${prefix}/provider/setting/engineer/edit/searchConfig`, params);
}
/******服务商修改工程师信息End********/

/*服务商审核*/

/**
 * 服务商审核信息
 * @param params
 * @returns {*}
 */
export function getProviderApproveDetail(params = {}) {
  return http.get(`${prefix}/provider/approve/getProviderApproveDetail`, params);
}


/**
 * 服务审批拒绝
 * @param params
 * @returns {*}
 */
export function approveRegisterProvider(params = {}) {
  return http.post(`${prefix}/provider/approve/approveRegisterProvider`, params);
}

/**
 * 服务商待审批数量信息
 * @param params
 * @returns {*}
 */
export function getApproveCount(params = {}) {
  return http.get(`${prefix}/provider/form/getApproveCount`, params);
}


/**
 * 根据服务商id获取服务商信息
 * @param params
 * @returns {*}
 */
export function getProviderNameList(params = {}) {
  return http.post(`${prefixOther}/outside/provider/role/getProviderNameList`, params);
}


/**
 * 根据服务商id获取服务商信息
 * @param params
 * @returns {*}
 */
export function checkByReportKey(params = {}) {
  return http.get('/api/dataware/outside/reportTheme/checkByReportKey', params);
}
/**
 * 设置租户服务商账号数
 * @param params
 * @returns {*}
 */
export function saveTenantProviderAccount(params = {}) {
  return http.get('/api/app/outside/provider/form/saveTenantProviderAccount', params);
}

/**
 * 删除服务商
 * @param params
 * @returns {*}
 */
export function deleteTenantProviderBatch(params = {}) {
  return http.post('/api/app/outside/provider/form/deleteTenantProviderBatch', params);
}
/**
 * h恢复服务商
 * @param params
 * @returns {*}
 */
export function restoreTenantProvider(params = {}) {
  return http.get('/api/app/outside/provider/form/restoreTenantProvider', params);
}